package com.wmwj.hxlj.utils;

import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
    // 自定义异常处理逻辑
    @ExceptionHandler(value = Exception.class)
    public Result handleException(Exception ex) {
        // 自定义异常处理逻辑
        ex.printStackTrace();
        return Result.error(StringUtils.hasLength(ex.getMessage()) ? ex.getMessage() : "未知错误");
    }
}
